﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace getPixelInformation
{
    public partial class Form2 : Form
    {
        private histogramEqualization hE;

        public Form2()
        {
            InitializeComponent();
        }

        private void btProcess_Click(object sender, EventArgs e)
        {
            OpenFileDialog oFD = new OpenFileDialog();
            oFD.Title = "Select a Bitmap file";
            oFD.InitialDirectory = Application.ExecutablePath;
            oFD.Filter = "Image Files (*.bmp) | *.bmp";
            oFD.FilterIndex = 2;
            oFD.FileName = "sample.bmp";
            string str = tbGreyLevel.Text.Trim();
            int number;
            bool isNum = int.TryParse(str, out number);
            if (oFD.ShowDialog() == DialogResult.OK && isNum == true)
            {
                //tbPath.Text = oFD.FileName;
                this.hE = new histogramEqualization(oFD.FileName.ToString(), number);
                this.hE.doHistogramEqualization(oFD.FileName.ToString());
                //this.P.getPixelInformation(oFD.FileName.ToString());
            }
            else
            {
                MessageBox.Show("You must enter Grey Level!");
            }

        }
    }
}
